import request from '@/utils/request'

/**
 * 订单列表
 * @param {参数} params 
 */
export function queryList(params) {
    return request({
        url: '/sys/order/list',
        method: 'get',
        params
    })
}

/**
 * 订单下拉列表
 * @param {参数} params 
 */
export function querySelect(params) {
    return request({
        url: '/sys/order/select',
        method: 'get',
        params
    })
}

/**
 * 订单信息
 * @param {主键} id 
 */
export function queryInfo(id) {
    return request({
        url: `/sys/order/${id}`,
        method: 'get'
    })
}

/**
 * 新增订单
 * @param {数据} data 
 */
export function saveOrder(data) {
    return request({
        url: '/sys/order/create',
        method: 'post',
        data
    })
}

/**
 * 修改订单
 * @param {数据} data 
 */
export function updateOrder(data) {
    return request({
        url: '/sys/order/update',
        method: 'post',
        data
    })
}

/**
 * 确认订单
 * @param {主键} id 
 */
export function confirmOrder(id) {
    return request({
        url: `/sys/order/confirm/${id}`,
        method: 'put'
    })
}

/**
 * 取消订单
 * @param {主键} id 
 */
export function cancelOrder(id) {
    return request({
        url: `/sys/order/cancel/${id}`,
        method: 'put'
    })
}

/**
 * 订单发货
 * @param {表单} data 
 */
export function shipmentOrder(data) {
    return request({
        url: `/sys/order/shipment`,
        method: 'put',
        data
    })
}

/**
 * 完成订单
 * @param {主键} id 
 */
export function receiptOrder(id) {
    return request({
        url: `/sys/order/receipt/${id}`,
        method: 'put'
    })
}

/**
 * 删除订单
 * @param {主键} id 
 */
export function deleteOrder(id) {
    return request({
        url: `/sys/order/delete/${id}`,
        method: 'delete'
    })
}